package com.itbbj.principle.d3_OCP.demo2;

import java.util.Random;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: jack_yang
 * @Date: 2024/5/6
 * @Description: addition and subtraction
 */
public abstract class Equation {
    protected int leftNum;
    protected int rightNum;
    protected String op;
    protected int result;
    @Override
    public String toString() {
        return leftNum + " " + op + " " + rightNum + " = " + result;
    }

    //1.产生指定区间的随机数
    public int generateRandom(int min, int max) {
        Random random = new Random();
        return random.nextInt(max - min + 1) + min;
    }
    public abstract Equation generateEquation();
}
